def solve(nums, k):
    n = len(nums)
    res = []
    for i in range(n - k, n + n - k):
        res.append(nums[i % n])
    nums[:] = res

    return nums


if __name__ == "__main__":
    nums = [1, 2, 3, 4, 5, 6, 7]
    k = 3
    print(solve(nums, k))
